package com.ruoyi.project.learn.ysdw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.learn.ysdw.mapper.DjAudioBookMapper;
import com.ruoyi.project.learn.ysdw.domain.DjAudioBook;
import com.ruoyi.project.learn.ysdw.service.IDjAudioBookService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 有声读物Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-17
 */
@Service
public class DjAudioBookServiceImpl implements IDjAudioBookService 
{
    @Autowired
    private DjAudioBookMapper djAudioBookMapper;

    /**
     * 查询有声读物
     * 
     * @param id 有声读物主键
     * @return 有声读物
     */
    @Override
    public DjAudioBook selectDjAudioBookById(Long id)
    {
        return djAudioBookMapper.selectDjAudioBookById(id);
    }

    /**
     * 查询有声读物列表
     * 
     * @param djAudioBook 有声读物
     * @return 有声读物
     */
    @Override
    public List<DjAudioBook> selectDjAudioBookList(DjAudioBook djAudioBook)
    {
        return djAudioBookMapper.selectDjAudioBookList(djAudioBook);
    }

    /**
     * 新增有声读物
     * 
     * @param djAudioBook 有声读物
     * @return 结果
     */
    @Override
    public int insertDjAudioBook(DjAudioBook djAudioBook)
    {
        djAudioBook.setCreateTime(DateUtils.getNowDate());
        return djAudioBookMapper.insertDjAudioBook(djAudioBook);
    }

    /**
     * 修改有声读物
     * 
     * @param djAudioBook 有声读物
     * @return 结果
     */
    @Override
    public int updateDjAudioBook(DjAudioBook djAudioBook)
    {
        djAudioBook.setUpdateTime(DateUtils.getNowDate());
        return djAudioBookMapper.updateDjAudioBook(djAudioBook);
    }

    /**
     * 批量删除有声读物
     * 
     * @param ids 需要删除的有声读物主键
     * @return 结果
     */
    @Override
    public int deleteDjAudioBookByIds(String ids)
    {
        return djAudioBookMapper.deleteDjAudioBookByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除有声读物信息
     * 
     * @param id 有声读物主键
     * @return 结果
     */
    @Override
    public int deleteDjAudioBookById(Long id)
    {
        return djAudioBookMapper.deleteDjAudioBookById(id);
    }
}
